import type { IEnums, IPageRequest } from '../global';

/**
 * 角色状态
 */
export enum ERoleStatus {
  /** 启用 */
  ENABLED = 0,
  /** 禁用 */
  DISABLED = 1,
}

export enum RoleAuthConditionEnums {
  DATA_MANAGER = '1',
  NON_DATA_MANAGER = '2',
}

export interface IRolePageRequest extends IPageRequest {
  name?: string;
  createBy?: string;
  status?: 0 | 1;
  createTime?: string;
}

export interface IRoleCreateRequest {
  id?: number;
  name: string;
  description: string;
  status: 0 | 1;
  permissionList: number[];
}

export interface IRoleDeatil extends IRoleCreateRequest {
  allSelectList: number[];
  defaultUrl: string;
  gmtCreate: string;
  id: number;
  roleCode: string;
  sysRole: boolean;
  dataPerm: { code: 'ALL' | 'SELF' | 'NEXT' };
  defaultFlag: boolean;
  status: 0 | 1;
  pageList: {
    menuId: number;
    menuName: string;
    pageUrl: string;
  }; // 可选页面集合
  updateUserStatus: IEnums;
  openRoleGroupFlag: IEnums;
  authConditionCode: IEnums;
  visibleList: Array<{ visibleAppCode: string; visibleAppName: string }>;
}

//角色详情
export interface IRoleInfo {
  id: number;
  status: 0 | 1;
  name: string;
  description: string;
  permissionList: number[];
}

//角色列表
export interface IRoleList {
  id: number;
  name: string;
  // roleNum: number;
  description: string;
  createTime: string;
  status: number;
  // status: IEnums;
}

//角色树
export interface IRoleTree {
  key: string;
  title: string;
  // parentKey: string;
  parentId: string;
  menuType?: number;
  children?: IRoleTree[];
  name?: string;
  id?: string;
}

//菜单权限树
export interface ImenuTree {
  menuId: number;
  menuName: string;
  pageUrl: string;
}

